package by.admonko.universaltesting.services.impl;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import by.admonko.universaltesting.dataaccess.AnswerDao;
import by.admonko.universaltesting.datamodel.Answer;
import by.admonko.universaltesting.datamodel.Question;
import by.admonko.universaltesting.services.AnswerService;

@Service
public class AnswerServiceImpl implements AnswerService {
	@Inject
	AnswerDao ansDao;

	@Override
	public Answer getAnswer(Integer id) {

		return ansDao.getById(id);
	}

	@Override
	public void setAnswer(Answer answer) {
		ansDao.insert(answer);

	}

	@Override
	public void removeAnswer(Integer id) {
		ansDao.delete(id);

	}

	@Override
	public void removeAnsByList(List<Integer> list) {
		ansDao.delete(list);

	}

	@Override
	public void updateAnswer(Answer answer) {
		ansDao.update(answer);

	}

	@Override
	public List<Answer> getByQuestion(Question quest) {
		return ansDao.getByQuestion(quest);
	}

}
